Socket
Socket
Sign inDemoInstall

turf-median

Package Overview
Dependencies
Maintainers
8
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

turf-median

turf median module


Version published
Weekly downloads
66
increased by164%
Maintainers
8
Weekly downloads
 
Created
Source

turf-median

build status

turf median module

turf.median(polygons, points, inField, outField)

Takes a set of polygons, a set of points, and tag polygons with the sum of point property values contained within.

Parameters

parametertypedescription
polygonsFeatureCollectiona FeatureCollection of Polygon features
pointsFeatureCollectiona FeatureCollection of Point features
inFieldstringthe field in input data to analyze
outFieldstringthe field in which to store results

Example

var polygons = turf.featurecollection([
  turf.polygon([[[0,0],[10,0],[10,10],[0,10],[0,0]]]),
  turf.polygon([[[10,0],[20,10],[20,20], [20,0]]])]);
var points = turf.featurecollection([
  turf.point([5,5], {population: 200}),
  turf.point([1,3], {population: 600}),
  turf.point([14,2], {population: 100}),
  turf.point([13,1], {population: 200}),
  turf.point([19,7], {population: 300})]);
var aggregated = turf.median(polygons, points, 'population', 'median');
//=polygons
//=points
//=aggregated

Installation

Requires nodejs.

$ npm install turf-median

Tests

$ npm test

Keywords

FAQs

Package last updated on 06 Feb 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc